
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>3.3.1 k8s · Ebook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="zq_sdk@163.com">
        
        
    
    <link rel="stylesheet" href="../../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-disqus/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-tree/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-local-video/video-js.min.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-ace/ace.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-katex/katex.min.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../rancher/rancher.html" />
    
    
    <link rel="prev" href="../build.html" />
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"repo":"TIME-GATE/","types":["star","watch"],"size":"large"};
    </script>

    
    <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-chart/c3/c3.min.css">
    <script src="../../../gitbook/gitbook-plugin-chart/c3/d3.min.js"></script>
    <script src="../../../gitbook/gitbook-plugin-chart/c3/c3.min.js"></script>
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../../">
            
                <a href="../../../">
            
                    
                    简介
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="../../../about_me.html">
            
                <a href="../../../about_me.html">
            
                    
                    关于
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="../../../gitbook_install.html">
            
                <a href="../../../gitbook_install.html">
            
                    
                    附:Gitbook安装
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../../">
            
                <a href="../../../">
            
                    
                    一 基础理论
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../../data_structure/">
            
                <a href="../../../data_structure/">
            
                    
                    1 数据结构
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../../../data_structure/11_linear_structure.html">
            
                <a href="../../../data_structure/11_linear_structure.html">
            
                    
                    1.1 数组、链表、跳表及字典
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1.1" data-path="../../../data_structure/111_array.html">
            
                <a href="../../../data_structure/111_array.html">
            
                    
                    1.1.1 数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.1.2" data-path="../../../data_structure/112_link_list.html">
            
                <a href="../../../data_structure/112_link_list.html">
            
                    
                    1.1.2 链表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.1.3" data-path="../../../data_structure/113_skip_list.html">
            
                <a href="../../../data_structure/113_skip_list.html">
            
                    
                    1.1.3 跳表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.1.4" data-path="../../../data_structure/114_dictionary.html">
            
                <a href="../../../data_structure/114_dictionary.html">
            
                    
                    1.1.4 字典
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="../../../data_structure/12_stack_and_queue.html">
            
                <a href="../../../data_structure/12_stack_and_queue.html">
            
                    
                    1.2 栈、队列、散列及集合
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.2.1" data-path="../../../data_structure/121_stack.html">
            
                <a href="../../../data_structure/121_stack.html">
            
                    
                    1.2.1 栈
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2.2" data-path="../../../data_structure/122_queue.html">
            
                <a href="../../../data_structure/122_queue.html">
            
                    
                    1.2.2 队列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2.3" data-path="../../../data_structure/123_hash.html">
            
                <a href="../../../data_structure/123_hash.html">
            
                    
                    1.2.3 散列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2.4" data-path="../../../data_structure/124_set.html">
            
                <a href="../../../data_structure/124_set.html">
            
                    
                    1.2.4 集合
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="../../../data_structure/13_tree_and_forest.html">
            
                <a href="../../../data_structure/13_tree_and_forest.html">
            
                    
                    1.3 树与森林
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.3.1" data-path="../../../data_structure/131.html">
            
                <a href="../../../data_structure/131.html">
            
                    
                    1.3.1 二叉搜索树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3.2" data-path="../../../data_structure/132.html">
            
                <a href="../../../data_structure/132.html">
            
                    
                    1.3.2 红黑树
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.1.4" data-path="../../../data_structure/14_map.html">
            
                <a href="../../../data_structure/14_map.html">
            
                    
                    1.4 图结构
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.4.1" data-path="../../../data_structure/141_minimal_tree.html">
            
                <a href="../../../data_structure/141_minimal_tree.html">
            
                    
                    1.4.1 最小生成树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4.2" data-path="../../../data_structure/142_single_source_shortest_path.html">
            
                <a href="../../../data_structure/142_single_source_shortest_path.html">
            
                    
                    1.4.2 单源最短路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4.3" data-path="../../../data_structure/143_all_source_shortest_path.html">
            
                <a href="../../../data_structure/143_all_source_shortest_path.html">
            
                    
                    1.4.3 多源最短路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4.4" data-path="../../../data_structure/144_max_stream.html">
            
                <a href="../../../data_structure/144_max_stream.html">
            
                    
                    1.4.4 最大流
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../../">
            
                <a href="../../../">
            
                    
                    2 基础算法
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../../../algorithm/21.html">
            
                <a href="../../../algorithm/21.html">
            
                    
                    2.1 排序查找
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="../../../algorithm/22.html">
            
                <a href="../../../algorithm/22.html">
            
                    
                    2.2 动态规划
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../../algorithm/distributed_algorithm.html">
            
                <a href="../../../algorithm/distributed_algorithm.html">
            
                    
                    3 分布式算法
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.3.1" data-path="../cs/theory.html">
            
                <a href="../cs/theory.html">
            
                    
                    3.1 一致性模式与理论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.2" data-path="../../../algorithm/raft.html">
            
                <a href="../../../algorithm/raft.html">
            
                    
                    3.2 Raft协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.3" data-path="../../../algorithm/paxos.html">
            
                <a href="../../../algorithm/paxos.html">
            
                    
                    3.3 Paxos协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.4" data-path="../../../algorithm/gossip.html">
            
                <a href="../../../algorithm/gossip.html">
            
                    
                    3.4 Gossip协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.5" data-path="../cs/plan.html">
            
                <a href="../cs/plan.html">
            
                    
                    3.5 几种一致性方案
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../../../optimization_se/">
            
                <a href="../../../optimization_se/">
            
                    
                    4 运筹及系统工程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.4.1" data-path="../../../optimization_se/linear_programming.html">
            
                <a href="../../../optimization_se/linear_programming.html">
            
                    
                    4.1 线性规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.2" data-path="../../../optimization_se/integer_programming.html">
            
                <a href="../../../optimization_se/integer_programming.html">
            
                    
                    4.2 整数规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.3" data-path="../../../optimization_se/目标规划.html">
            
                <a href="../../../optimization_se/目标规划.html">
            
                    
                    4.3 目标规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.4" data-path="../../../optimization_se/非线性规划.html">
            
                <a href="../../../optimization_se/非线性规划.html">
            
                    
                    4.4 非线性规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.5" data-path="../../../optimization_se/动态规划.html">
            
                <a href="../../../optimization_se/动态规划.html">
            
                    
                    4.5 动态规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.6" data-path="../../../optimization_se/排队论.html">
            
                <a href="../../../optimization_se/排队论.html">
            
                    
                    4.6 排队论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.7" data-path="../../../optimization_se/博弈论.html">
            
                <a href="../../../optimization_se/博弈论.html">
            
                    
                    4.7 博弈论
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    二 工程应用
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../design_pattern/">
            
                <a href="../../design_pattern/">
            
                    
                    1 设计模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1.1" data-path="../../design_pattern/strategy.html">
            
                <a href="../../design_pattern/strategy.html">
            
                    
                    1.1 策略模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.2" data-path="../../design_pattern/prototype.html">
            
                <a href="../../design_pattern/prototype.html">
            
                    
                    1.2 原型模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.3" data-path="../../design_pattern/singleton.html">
            
                <a href="../../design_pattern/singleton.html">
            
                    
                    1.3 单例模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.4" data-path="../../design_pattern/factory.html">
            
                <a href="../../design_pattern/factory.html">
            
                    
                    1.4 工厂模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.5" data-path="../../design_pattern/bridge.html">
            
                <a href="../../design_pattern/bridge.html">
            
                    
                    1.5 桥接模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.6" data-path="../../design_pattern/composite.html">
            
                <a href="../../design_pattern/composite.html">
            
                    
                    1.6 组合模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.7" data-path="../../design_pattern/facade.html">
            
                <a href="../../design_pattern/facade.html">
            
                    
                    1.7 门面模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.8" data-path="../../design_pattern/adapter.html">
            
                <a href="../../design_pattern/adapter.html">
            
                    
                    1.8 适配器模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.9" data-path="../../design_pattern/decorator.html">
            
                <a href="../../design_pattern/decorator.html">
            
                    
                    1.9 装饰者模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.10" data-path="../../design_pattern/flyweight.html">
            
                <a href="../../design_pattern/flyweight.html">
            
                    
                    1.10 享元模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.11" data-path="../../design_pattern/proxy.html">
            
                <a href="../../design_pattern/proxy.html">
            
                    
                    1.11 代理模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.12" data-path="../../design_pattern/middleware.html">
            
                <a href="../../design_pattern/middleware.html">
            
                    
                    1.12 中间件模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../network_prag/">
            
                <a href="../../network_prag/">
            
                    
                    2 网络编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.2.1" data-path="../../network_prag/socket.html">
            
                <a href="../../network_prag/socket.html">
            
                    
                    2.1 长连接
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.2" data-path="../../network_prag/mq.html">
            
                <a href="../../network_prag/mq.html">
            
                    
                    2.2 MQ
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../../../program/">
            
                <a href="../../../program/">
            
                    
                    3 语言应用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1" data-path="../../../program/nodejs/node.html">
            
                <a href="../../../program/nodejs/node.html">
            
                    
                    3.1 Node.js
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1.1" data-path="../../../program/nodejs/core.html">
            
                <a href="../../../program/nodejs/core.html">
            
                    
                    3.1.1 原理及构成
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.2" data-path="../../../program/nodejs/async.html">
            
                <a href="../../../program/nodejs/async.html">
            
                    
                    3.1.2 异步机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.3" data-path="../../../program/nodejs/important.html">
            
                <a href="../../../program/nodejs/important.html">
            
                    
                    3.1.3 一些核心概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.4" data-path="../../../program/nodejs/koa_web.html">
            
                <a href="../../../program/nodejs/koa_web.html">
            
                    
                    3.1.4 web应用: koa框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.5" data-path="../../../program/nodejs/koa.html">
            
                <a href="../../../program/nodejs/koa.html">
            
                    
                    3.1.5 koa源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.6" data-path="../../../program/nodejs/libuv.html">
            
                <a href="../../../program/nodejs/libuv.html">
            
                    
                    3.1.6 libuv网络库应用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.7" data-path="../../../program/nodejs/apm.html">
            
                <a href="../../../program/nodejs/apm.html">
            
                    
                    3.1.7 性能调优
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.8" data-path="../../../program/nodejs/node_spider.html">
            
                <a href="../../../program/nodejs/node_spider.html">
            
                    
                    3.1.8 其他: Node爬虫
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.9" data-path="../../../program/nodejs/node_map_reduce.html">
            
                <a href="../../../program/nodejs/node_map_reduce.html">
            
                    
                    3.1.9 其他: Node编写Mapreduce
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.3.2" data-path="../../../program/c/c_and_plus.html">
            
                <a href="../../../program/c/c_and_plus.html">
            
                    
                    3.2 C/C++
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.2.1" data-path="../../../program/c/oop.html">
            
                <a href="../../../program/c/oop.html">
            
                    
                    3.2.1 面向对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.2" data-path="../../../program/c/ipcs.html">
            
                <a href="../../../program/c/ipcs.html">
            
                    
                    3.2.2 进程通信
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.3" data-path="../../../program/c/thread.html">
            
                <a href="../../../program/c/thread.html">
            
                    
                    3.2.3 线程管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.4" data-path="../../../program/c/memory.html">
            
                <a href="../../../program/c/memory.html">
            
                    
                    3.2.4 内存管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.5" data-path="../../../program/c/network.html">
            
                <a href="../../../program/c/network.html">
            
                    
                    3.2.5 网络编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.6" data-path="../../../program/c/build_tool.html">
            
                <a href="../../../program/c/build_tool.html">
            
                    
                    3.2.6 构建工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.7" data-path="../../../program/c/thread_pool.html">
            
                <a href="../../../program/c/thread_pool.html">
            
                    
                    3.2.7 其他: 线程池
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../">
            
                <a href="../">
            
                    
                    三 搭建部署
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../test.html">
            
                <a href="../test.html">
            
                    
                    3.1 测试
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../test/unit_testing.html">
            
                <a href="../test/unit_testing.html">
            
                    
                    3.1.1 单元测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../test/stress_testing.html">
            
                <a href="../test/stress_testing.html">
            
                    
                    3.1.2 压力测试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../ci_readme.html">
            
                <a href="../ci_readme.html">
            
                    
                    3.2 集成
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.2.1" data-path="../ci/gitlab_ci.html">
            
                <a href="../ci/gitlab_ci.html">
            
                    
                    3.2.1 GitLab CI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.2" data-path="../ci/spinnaker.html">
            
                <a href="../ci/spinnaker.html">
            
                    
                    3.2.2 Spinnaker
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../build.html">
            
                <a href="../build.html">
            
                    
                    3.3 部署
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.4.3.1" data-path="k8s.html">
            
                <a href="k8s.html">
            
                    
                    3.3.1 k8s
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.2" data-path="../rancher/rancher.html">
            
                <a href="../rancher/rancher.html">
            
                    
                    3.3.2 rancher
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.3" data-path="../swarm/swarm.html">
            
                <a href="../swarm/swarm.html">
            
                    
                    3.3.3 swarm
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../maintenance.html">
            
                <a href="../maintenance.html">
            
                    
                    3.4 监控
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.1" data-path="../monitor.html">
            
                <a href="../monitor.html">
            
                    
                    3.4.1 容器监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2" data-path="../trace.html">
            
                <a href="../trace.html">
            
                    
                    3.4.2 系统监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3" data-path="../app1.md">
            
                <span>
            
                    
                    3.4.2 应用监控
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../../ha/ha.html">
            
                <a href="../../ha/ha.html">
            
                    
                    3.5 高可用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.5.1" data-path="../../ha/client.html">
            
                <a href="../../ha/client.html">
            
                    
                    3.5.1 接入层高可用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.2" data-path="../../ha/service.html">
            
                <a href="../../ha/service.html">
            
                    
                    3.5.2 服务层高可用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.3" data-path="../../ha/share.html">
            
                <a href="../../ha/share.html">
            
                    
                    3.5.3 存储层高可用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../hc/hc.html">
            
                <a href="../hc/hc.html">
            
                    
                    3.6 高并发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.6.1" data-path="../hc/dns.html">
            
                <a href="../hc/dns.html">
            
                    
                    3.6.1 基于DNS的负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6.2" data-path="../hc/lvs.html">
            
                <a href="../hc/lvs.html">
            
                    
                    3.6.2 基于Lvs的负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6.3" data-path="../hc/haproxy.html">
            
                <a href="../hc/haproxy.html">
            
                    
                    3.6.3 基于haproxy的负载均衡
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    四 架构模式
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" >
            
                <span>
            
                    
                    1 微服务架构设计与实践
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1.1" data-path="../../../program/java/spring-cloud.html">
            
                <a href="../../../program/java/spring-cloud.html">
            
                    
                    1.1 微服务概况
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.2" data-path="../../../program/java/spring-eureka.html">
            
                <a href="../../../program/java/spring-eureka.html">
            
                    
                    1.2 服务注册及发现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.3" data-path="../../../program/java/spring-feign.html">
            
                <a href="../../../program/java/spring-feign.html">
            
                    
                    1.3 服务调用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.4" data-path="../../../program/java/spring-zuul.html">
            
                <a href="../../../program/java/spring-zuul.html">
            
                    
                    1.4 网关及负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.5" data-path="../../../program/java/spring-hystrix.html">
            
                <a href="../../../program/java/spring-hystrix.html">
            
                    
                    1.5 熔断、限流、扩缩容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.6" data-path="../../../program/java/spring-config.html">
            
                <a href="../../../program/java/spring-config.html">
            
                    
                    1.6 云配置中心
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.7" data-path="../../../program/java/zipkin-tracing.html">
            
                <a href="../../../program/java/zipkin-tracing.html">
            
                    
                    1.7 分布式链路追踪
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.8" data-path="../../../program/java/swagger.html">
            
                <a href="../../../program/java/swagger.html">
            
                    
                    1.8 接口文档管理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../../../domain/">
            
                <a href="../../../domain/">
            
                    
                    2 领域驱动模型
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.2.1" data-path="../../../domain/domain.html">
            
                <a href="../../../domain/domain.html">
            
                    
                    2.1 领域--Domain
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.2" data-path="../../../domain/entity.md">
            
                <span>
            
                    
                    2.2 领域实体--Entity
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.3" data-path="../../../domain/object.html">
            
                <a href="../../../domain/object.html">
            
                    
                    2.3 值对象--Value Object
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.4" data-path="../../../domain/aggregate.html">
            
                <a href="../../../domain/aggregate.html">
            
                    
                    2.4 聚合--Aggregate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.5" data-path="../../../domain/service.html">
            
                <a href="../../../domain/service.html">
            
                    
                    2.5 服务--Services
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.6" data-path="../../../domain/event.html">
            
                <a href="../../../domain/event.html">
            
                    
                    2.6 领域事件--Event
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.7" data-path="../../../domain/framework.html">
            
                <a href="../../../domain/framework.html">
            
                    
                    2.7 几种常见的DDD架构
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.3" >
            
                <span>
            
                    
                    3 架构技术的演化与趋势
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.3.1" >
            
                <span>
            
                    
                    3.1 架构技术的发展历史及现状
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3.2" >
            
                <span>
            
                    
                    3.2 Serverless无服务架构概念
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3.3" >
            
                <span>
            
                    
                    3.3 ServerMesh网格服务概念
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    五 其他
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../../story/talk.html">
            
                <a href="../../../story/talk.html">
            
                    
                    5.1 小伙子,放松!
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../.." >3.3.1 k8s</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h3 id="&#x4E00;&#x3001;k8s&#x7B80;&#x4ECB;">&#x4E00;&#x3001;k8s&#x7B80;&#x4ECB;</h3>
<p>&#xA0;&#xA0;&#xA0;&#xA0;Kubernetes&#x662F;Google&#x5F00;&#x6E90;&#x7684;&#x5BB9;&#x5668;&#x96C6;&#x7FA4;&#x7BA1;&#x7406;&#x7CFB;&#x7EDF;&#xFF0C;&#x5176;&#x63D0;&#x4F9B;&#x5E94;&#x7528;&#x90E8;&#x7F72;&#x3001;&#x7EF4;&#x62A4;&#x3001; &#x6269;&#x5C55;&#x673A;&#x5236;&#x7B49;&#x529F;&#x80FD;&#xFF0C;&#x5229;&#x7528;Kubernetes&#x80FD;&#x65B9;&#x4FBF;&#x5730;&#x7BA1;&#x7406;&#x8DE8;&#x673A;&#x5668;&#x8FD0;&#x884C;&#x5BB9;&#x5668;&#x5316;&#x7684;&#x5E94;&#x7528;&#xFF0C;&#x662F;Docker&#x5206;&#x5E03;&#x5F0F;&#x7CFB;&#x7EDF;&#x7684;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#xFF0C;&#x4E0E;&#x4E4B;&#x529F;&#x80FD;&#x7C7B;&#x4F3C;&#x7684;&#x8FD8;&#x5305;&#x62EC;Swarm&#x3001;Mesos&#x7B49;&#x3002;</p>
<h4 id="11-&#x67B6;&#x6784;&#x62D3;&#x6251;&#x56FE;">1.1 &#x67B6;&#x6784;&#x62D3;&#x6251;&#x56FE;</h4>
<p><img src="http://cdn.find-world.top/k8s_1.jpeg" alt="k8s_1"></p>
<h4 id="12-&#x6838;&#x5FC3;&#x7EC4;&#x4EF6;">1.2 &#x6838;&#x5FC3;&#x7EC4;&#x4EF6;</h4>
<ul>
<li>kube-scheduler</li>
</ul>
<pre><code>&#x96C6;&#x7FA4;&#x5206;&#x53D1;&#x8C03;&#x5EA6;&#x5668;&#xFF1A;
1&#x3001;Scheduler&#x6536;&#x96C6;&#x548C;&#x5206;&#x6790;&#x5F53;&#x524D;Kubernetes&#x96C6;&#x7FA4;&#x4E2D;&#x6240;&#x6709;Minion/Node&#x8282;&#x70B9;&#x7684;&#x8D44;&#x6E90;(&#x5185;&#x5B58;&#x3001;CPU)&#x8D1F;&#x8F7D;&#x60C5;&#x51B5;&#xFF0C;&#x7136;&#x540E;&#x4F9D;&#x6B64;&#x5206;&#x53D1;&#x65B0;&#x5EFA;&#x7684;Pod&#x5230;Kubernetes&#x96C6;&#x7FA4;&#x4E2D;&#x53EF;&#x7528;&#x7684;&#x8282;&#x70B9;
2&#x3001;&#x5B9E;&#x65F6;&#x76D1;&#x6D4B;Kubernetes&#x96C6;&#x7FA4;&#x4E2D;&#x672A;&#x5206;&#x53D1;&#x548C;&#x5DF2;&#x5206;&#x53D1;&#x7684;&#x6240;&#x6709;&#x8FD0;&#x884C;&#x7684;Pod
3&#x3001;Scheduler&#x4E5F;&#x76D1;&#x6D4B;Minion/Node&#x8282;&#x70B9;&#x4FE1;&#x606F;&#xFF0C;&#x7531;&#x4E8E;&#x4F1A;&#x9891;&#x7E41;&#x67E5;&#x627E;Minion/Node&#x8282;&#x70B9;&#xFF0C;Scheduler&#x4F1A;&#x7F13;&#x5B58;&#x4E00;&#x4EFD;&#x6700;&#x65B0;&#x7684;&#x4FE1;&#x606F;&#x5728;&#x672C;&#x5730;
4&#x3001;&#x6700;&#x540E;&#xFF0C;Scheduler&#x5728;&#x5206;&#x53D1;Pod&#x5230;&#x6307;&#x5B9A;&#x7684;Minion/Node&#x8282;&#x70B9;&#x540E;&#xFF0C;&#x4F1A;&#x628A;Pod&#x76F8;&#x5173;&#x7684;&#x4FE1;&#x606F;Binding&#x5199;&#x56DE;API Server&#x3002;
</code></pre><ul>
<li>kube-apiserver</li>
</ul>
<pre><code>&#x63D0;&#x4F9B;&#x4E86;&#x8D44;&#x6E90;&#x5BF9;&#x8C61;&#x7684;&#x552F;&#x4E00;&#x64CD;&#x4F5C;&#x5165;&#x53E3;&#xFF0C;&#x5176;&#x4ED6;&#x6240;&#x6709;&#x7EC4;&#x4EF6;&#x90FD;&#x5FC5;&#x987B;&#x901A;&#x8FC7;&#x5B83;&#x63D0;&#x4F9B;&#x7684;API&#x6765;&#x64CD;&#x4F5C;&#x8D44;&#x6E90;&#x6570;&#x636E;&#xFF0C;&#x53EA;&#x6709;API Server&#x4E0E;&#x5B58;&#x50A8;&#x901A;
&#x4FE1;&#xFF0C;&#x5176;&#x4ED6;&#x6A21;&#x5757;&#x901A;&#x8FC7;API Server&#x8BBF;&#x95EE;&#x96C6;&#x7FA4;&#x72B6;&#x6001;&#xFF0C; &#x4FDD;&#x8BC1;&#x96C6;&#x7FA4;&#x72B6;&#x6001;&#x8BBF;&#x95EE;&#x7684;&#x5B89;&#x5168;
</code></pre><ul>
<li>kube-controller-manager</li>
</ul>
<pre><code>&#x5B9E;&#x73B0;&#x96C6;&#x7FA4;&#x6545;&#x969C;&#x68C0;&#x6D4B;&#x548C;&#x6062;&#x590D;&#x7684;&#x81EA;&#x52A8;&#x5316;&#x5DE5;&#x4F5C;&#xFF1A;
1&#x3001;endpoint-controller&#xFF1A;&#x5B9A;&#x671F;&#x5173;&#x8054;service&#x548C;pod(&#x5173;&#x8054;&#x4FE1;&#x606F;&#x7531;endpoint&#x5BF9;&#x8C61;&#x7EF4;&#x62A4;)&#xFF0C;&#x4FDD;&#x8BC1;service&#x5230;pod&#x7684;&#x6620;&#x5C04;&#x603B;&#x662F;&#x6700;&#x65B0;&#x7684;
2&#x3001;replication-controller&#xFF1A;&#x5B9A;&#x671F;&#x5173;&#x8054;replicationController&#x548C;pod&#xFF0C;&#x4FDD;&#x8BC1;replicationController&#x5B9A;&#x4E49;&#x7684;&#x590D;&#x5236;&#x6570;&#x91CF;&#x4E0E;&#x5B9E;&#x9645;&#x8FD0;&#x884C;pod&#x7684;&#x6570;&#x91CF;&#x603B;&#x662F;&#x4E00;&#x81F4;&#x7684;
</code></pre><ul>
<li>kubelet</li>
</ul>
<pre><code>Pod&#x7BA1;&#x5BB6;
1&#x3001;&#x8D1F;&#x8D23;Node&#x8282;&#x70B9;&#x4E0A;pod&#x7684;&#x521B;&#x5EFA;&#x3001;&#x4FEE;&#x6539;&#x3001;&#x76D1;&#x63A7;&#x3001;&#x5220;&#x9664;&#x7B49;&#x5168;&#x751F;&#x547D;&#x5468;&#x671F;&#x7684;&#x7BA1;&#x7406;
2&#x3001;&#x5B9A;&#x65F6;&#x4E0A;&#x62A5;&#x672C;Node&#x7684;&#x72B6;&#x6001;&#x4FE1;&#x606F;&#x7ED9;API Server&#x3002;
3&#x3001;kubelet&#x662F;Master API Server&#x548C;Node&#x4E4B;&#x95F4;&#x7684;&#x6865;&#x6881;&#xFF0C;&#x63A5;&#x6536;Master API Server&#x5206;&#x914D;&#x7ED9;&#x5B83;&#x7684;commands&#x548C;work&#xFF0C;&#x901A;&#x8FC7;kube-apiserver&#x95F4;&#x63A5;&#x4E0E;Etcd&#x96C6;&#x7FA4;&#x4EA4;&#x4E92;&#xFF0C;&#x8BFB;&#x53D6;&#x914D;&#x7F6E;&#x4FE1;&#x606F;&#x3002;
</code></pre><ul>
<li>kube-proxy</li>
</ul>
<pre><code>&#x8D1F;&#x8F7D;&#x5747;&#x8861;&#x3001;&#x8DEF;&#x7531;&#x8F6C;&#x53D1;&#xFF1A;Proxy&#x662F;&#x4E3A;&#x4E86;&#x89E3;&#x51B3;&#x5916;&#x90E8;&#x7F51;&#x7EDC;&#x80FD;&#x591F;&#x8BBF;&#x95EE;&#x8DE8;&#x673A;&#x5668;&#x96C6;&#x7FA4;&#x4E2D;&#x5BB9;&#x5668;&#x63D0;&#x4F9B;&#x7684;&#x5E94;&#x7528;&#x670D;&#x52A1;&#x800C;&#x8BBE;&#x8BA1;&#x7684;&#xFF0C;&#x8FD0;&#x884C;&#x5728;&#x6BCF;&#x4E2A;
Node&#x4E0A;&#x3002;Proxy&#x63D0;&#x4F9B;TCP/UDP sockets&#x7684;proxy&#xFF0C;&#x6BCF;&#x521B;&#x5EFA;&#x4E00;&#x79CD;Service&#xFF0C;Proxy&#x4E3B;&#x8981;&#x4ECE;etcd&#x83B7;&#x53D6;Services&#x548C;
Endpoints&#x7684;&#x914D;&#x7F6E;&#x4FE1;&#x606F;&#xFF0C;&#x4F7F;&#x7528;&#x968F;&#x673A;&#x3001;&#x8F6E;&#x5FAA;&#x8D1F;&#x8F7D;&#x5747;&#x8861;&#x7B97;&#x6CD5;
</code></pre><ul>
<li>docker engine</li>
</ul>
<p>&#xA0;&#xA0;&#xA0;&#xA0;&#x5305;&#x542B;&#x4E86;Docker Daemon&#x3001;REST API&#x3001;CLI(command line interface)&#x7684;&#x4E00;&#x5957;&#x5E94;&#x7528;</p>
<ul>
<li>etcd</li>
</ul>
<p>&#xA0;&#xA0;&#xA0;&#xA0;etcd&#x662F;&#x4E00;&#x4E2A;&#x5F00;&#x6E90;&#x7684;&#x3001;&#x5206;&#x5E03;&#x5F0F;&#x7684;&#x952E;&#x503C;&#x5BF9;&#x6570;&#x636E;&#x5B58;&#x50A8;&#x7CFB;&#x7EDF;&#xFF0C;&#x63D0;&#x4F9B;&#x5171;&#x4EAB;&#x914D;&#x7F6E;&#x3001;&#x670D;&#x52A1;&#x7684;&#x6CE8;&#x518C;&#x548C;&#x53D1;&#x73B0;&#x3002;etcd&#x4E0E;zookeeper&#x76F8;&#x6BD4;&#x7B97;&#x662F;&#x8F7B;&#x91CF;&#x7EA7;&#x7CFB;&#x7EDF;&#xFF0C;&#x4E24;&#x8005;&#x7684;&#x4E00;&#x81F4;&#x6027;&#x534F;&#x8BAE;&#x4E5F;&#x4E00;&#x6837;&#xFF0C;etcd&#x7684;raft&#x6BD4;zookeeper&#x7684;paxos&#x7B80;&#x5355;</p>
<ul>
<li>kubectl</li>
</ul>
<p>&#xA0;&#xA0;&#xA0;&#xA0;&#x96C6;&#x7FA4;&#x7BA1;&#x7406;&#x547D;&#x4EE4;&#x884C;&#x5DE5;&#x5177;&#x96C6;</p>
<h4 id="13-&#x7F51;&#x7EDC;&#x65B9;&#x6848;">1.3 &#x7F51;&#x7EDC;&#x65B9;&#x6848;</h4>
<ul>
<li>Overlay Networking</li>
</ul>
<p>&#xA0;&#xA0;&#xA0;&#xA0;docker&#x901A;&#x8FC7;&#x5728;&#x73B0;&#x6709;&#x4E8C;&#x5C42;&#x6216;&#x4E09;&#x5C42;&#x7F51;&#x7EDC;&#x4E4B;&#x4E0A;&#x518D;&#x6784;&#x5EFA;&#x8D77;&#x6765;&#x4E00;&#x4E2A;&#x72EC;&#x7ACB;&#x7684;&#x7F51;&#x7EDC;&#xFF0C;&#x8FD9;&#x4E2A;&#x7F51;&#x7EDC;&#x901A;&#x5E38;&#x4F1A;&#x6709;&#x81EA;&#x5DF1;&#x72EC;&#x7ACB;&#x7684;IP&#x5730;&#x5740;&#x7A7A;&#x95F4;&#x3001;&#x4EA4;&#x6362;&#x6216;&#x8005;&#x8DEF;&#x7531;&#x7684;&#x5B9E;&#x73B0;&#x3002;Linux&#x5728;&#x7F51;&#x7EDC;&#x6808;&#x4E2D;&#x5F15;&#x5165;&#x7F51;&#x7EDC;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#xFF0C;&#x5C06;&#x72EC;&#x7ACB;&#x7684;&#x7F51;&#x7EDC;&#x534F;&#x8BAE;&#x6808;&#x9694;&#x79BB;&#x5230;&#x4E0D;&#x540C;&#x7684;&#x547D;&#x4EE4;&#x7A7A;&#x95F4;&#x4E2D;&#xFF0C;&#x5F7C;&#x6B64;&#x95F4;&#x65E0;&#x6CD5;&#x901A;&#x4FE1;&#xFF1B;Docker&#x5229;&#x7528;&#x8FD9;&#x4E00;&#x7279;&#x6027;&#xFF0C;&#x5B9E;&#x73B0;&#x4E0D;&#x540C;&#x5BB9;&#x5668;&#x95F4;&#x7684;&#x7F51;&#x7EDC;&#x9694;&#x79BB;&#xFF0C;docker0&#x662F;&#x4E00;&#x4E2A;&#x8FDE;&#x63A5;&#x4E24;&#x4E2A;&#x5BF9;&#x7B49;&#x7F51;&#x7EDC;&#x4E4B;&#x95F4;&#x7684;&#x865A;&#x62DF;&#x7F51;&#x6865;&#xFF0C;&#x901A;&#x8FC7;&#x8BE5;&#x7F51;&#x6865;&#x53EF;&#x4EE5;&#x5C06;Linux&#x652F;&#x6301;&#x7684;&#x4E0D;&#x540C;&#x7684;&#x7AEF;&#x53E3;&#x8FDE;&#x63A5;&#x8D77;&#x6765;&#xFF0C;&#x5E76;&#x5B9E;&#x73B0;&#x7C7B;&#x4F3C;&#x4EA4;&#x6362;&#x673A;&#x90A3;&#x6837;&#x7684;&#x591A;&#x5BF9;&#x591A;&#x7684;&#x901A;&#x4FE1;,&#x540C;&#x4E00;&#x4E2A;Pod&#x7684;&#x5BB9;&#x5668;&#x5171;&#x4EAB;&#x540C;&#x4E00;&#x4E2A;&#x7F51;&#x7EDC;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#xFF0C;&#x5B83;&#x4EEC;&#x4E4B;&#x95F4;&#x7684;&#x8BBF;&#x95EE;&#x53EF;&#x4EE5;&#x7528;localhost&#x5730;&#x5740; + &#x5BB9;&#x5668;&#x7AEF;&#x53E3;,&#x540C;&#x4E00;Node&#x4E2D;Pod&#x7684;&#x9ED8;&#x8BA4;&#x8DEF;&#x7531;&#x90FD;&#x662F;docker0&#x7684;&#x5730;&#x5740;&#xFF0C;&#x7531;&#x4E8E;&#x5B83;&#x4EEC;&#x5173;&#x8054;&#x5728;&#x540C;&#x4E00;&#x4E2A;docker0&#x7F51;&#x6865;&#x4E0A;&#xFF0C;&#x5730;&#x5740;&#x7F51;&#x6BB5;&#x76F8;&#x540C;&#xFF0C;&#x6240;&#x6709;&#x5B83;&#x4EEC;&#x4E4B;&#x95F4;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x901A;&#x4FE1;</p>
<ul>
<li>Flannel&#x5BB9;&#x5668;&#x7F51;&#x7EDC;</li>
</ul>
<p>&#xA0;&#xA0;&#xA0;&#xA0;Flannel&#x662F;CoreOS&#x56E2;&#x961F;&#x9488;&#x5BF9;Kubernetes&#x8BBE;&#x8BA1;&#x7684;&#x4E00;&#x4E2A;&#x7F51;&#x7EDC;&#x89C4;&#x5212;&#x670D;&#x52A1;&#xFF0C;&#x7B80;&#x5355;&#x6765;&#x8BF4;&#xFF0C;&#x5B83;&#x7684;&#x529F;&#x80FD;&#x662F;&#x8BA9;&#x96C6;&#x7FA4;&#x4E2D;&#x7684;&#x4E0D;&#x540C;&#x8282;&#x70B9;&#x4E3B;&#x673A;&#x521B;&#x5EFA;&#x7684;Docker&#x5BB9;&#x5668;&#x90FD;&#x5177;&#x6709;&#x5168;&#x96C6;&#x7FA4;&#x552F;&#x4E00;&#x7684;&#x865A;&#x62DF;IP&#x5730;&#x5740;&#x3002;</p>
<p>&#xA0;&#xA0;&#xA0;&#xA0;&#x5728;&#x9ED8;&#x8BA4;&#x7684;Docker&#x914D;&#x7F6E;&#x4E2D;&#xFF0C;&#x6BCF;&#x4E2A;&#x8282;&#x70B9;&#x4E0A;&#x7684;Docker&#x670D;&#x52A1;&#x4F1A;&#x5206;&#x522B;&#x8D1F;&#x8D23;&#x6240;&#x5728;&#x8282;&#x70B9;&#x5BB9;&#x5668;&#x7684;IP&#x5206;&#x914D;&#x3002;&#x8FD9;&#x6837;&#x5BFC;&#x81F4;&#x7684;&#x4E00;&#x4E2A;&#x95EE;&#x9898;&#x662F;&#xFF0C;&#x4E0D;&#x540C;&#x8282;&#x70B9;&#x4E0A;&#x5BB9;&#x5668;&#x53EF;&#x80FD;&#x83B7;&#x5F97;&#x76F8;&#x540C;&#x7684;&#x5185;&#x5916;IP&#x5730;&#x5740;&#x3002;&#x5E76;&#x4F7F;&#x8FD9;&#x4E9B;&#x5BB9;&#x5668;&#x4E4B;&#x95F4;&#x80FD;&#x591F;&#x4E4B;&#x95F4;&#x901A;&#x8FC7;IP&#x5730;&#x5740;&#x76F8;&#x4E92;&#x627E;&#x5230;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x76F8;&#x4E92;ping&#x901A;&#x3002;</p>
<p>&#xA0;&#xA0;&#xA0;&#xA0;Flannel&#x7684;&#x8BBE;&#x8BA1;&#x76EE;&#x7684;&#x5C31;&#x662F;&#x4E3A;&#x96C6;&#x7FA4;&#x4E2D;&#x7684;&#x6240;&#x6709;&#x8282;&#x70B9;&#x91CD;&#x65B0;&#x89C4;&#x5212;IP&#x5730;&#x5740;&#x7684;&#x4F7F;&#x7528;&#x89C4;&#x5219;&#xFF0C;&#x4ECE;&#x800C;&#x4F7F;&#x5F97;&#x4E0D;&#x540C;&#x8282;&#x70B9;&#x4E0A;&#x7684;&#x5BB9;&#x5668;&#x80FD;&#x591F;&#x83B7;&#x5F97;&#x201C;&#x540C;&#x5C5E;&#x4E00;&#x4E2A;&#x5185;&#x7F51;&#x201D;&#x4E14;&#x201D;&#x4E0D;&#x91CD;&#x590D;&#x7684;&#x201D;IP&#x5730;&#x5740;&#xFF0C;&#x5E76;&#x8BA9;&#x5C5E;&#x4E8E;&#x4E0D;&#x540C;&#x8282;&#x70B9;&#x4E0A;&#x7684;&#x5BB9;&#x5668;&#x80FD;&#x591F;&#x76F4;&#x63A5;&#x901A;&#x8FC7;&#x5185;&#x7F51;IP&#x901A;&#x4FE1;&#x3002;</p>
<p>&#xA0;&#xA0;&#xA0;&#xA0;Flannel&#x5B9E;&#x8D28;&#x4E0A;&#x662F;&#x4E00;&#x79CD;&#x201C;&#x8986;&#x76D6;&#x7F51;&#x7EDC;&#xFF08;overlaynetwork&#xFF09;&#x201D;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x5C06;TCP&#x6570;&#x636E;&#x5305;&#x88C5;&#x5728;&#x53E6;&#x4E00;&#x79CD;&#x7F51;&#x7EDC;&#x5305;&#x91CC;&#x9762;&#x8FDB;&#x884C;&#x8DEF;&#x7531;&#x8F6C;&#x53D1;&#x548C;&#x901A;&#x4FE1;&#xFF0C;&#x76EE;&#x524D;&#x5DF2;&#x7ECF;&#x652F;&#x6301;UDP&#x3001;VXLAN&#x3001;host-gw&#x3001;aws-vpc&#x3001;GCE&#x548C;Alloc&#x8DEF;&#x7531;&#x7B49;&#x6570;&#x636E;&#x8F6C;&#x53D1;&#x65B9;&#x5F0F;&#xFF0C;&#x9ED8;&#x8BA4;&#x7684;&#x8282;&#x70B9;&#x95F4;&#x6570;&#x636E;&#x901A;&#x4FE1;&#x65B9;&#x5F0F;&#x662F;UDP&#x8F6C;&#x53D1;</p>
<h3 id="&#x4E8C;&#x3001;&#x5B9E;&#x8DF5;&#x4E4B;&#x8DEF;">&#x4E8C;&#x3001;&#x5B9E;&#x8DF5;&#x4E4B;&#x8DEF;</h3>
<h4 id="21-&#x901A;&#x8FC7;kubectl&#x521B;&#x5EFA;pod">2.1 &#x901A;&#x8FC7;kubectl&#x521B;&#x5EFA;pod</h4>
<pre><code class="lang-bash">kubectl create <span class="hljs-_">-f</span> spring-config-service.yml 
||
kubectl apply <span class="hljs-_">-f</span> spring-config-service.yml
</code></pre>
<pre><code class="lang-yaml"><span class="hljs-attr">apiVersion:</span> extensions/v1beta1
<span class="hljs-attr">kind:</span> Deployment
<span class="hljs-attr">metadata:</span>
<span class="hljs-attr">  name:</span> config-server
<span class="hljs-attr">  labels:</span>
<span class="hljs-attr">    app:</span> config-server
<span class="hljs-attr">spec:</span>
<span class="hljs-attr">  replicas:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">  strategy:</span>
<span class="hljs-attr">    rollingUpdate:</span>
<span class="hljs-attr">      maxSurge:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">      maxUnavailable:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">  template:</span>
<span class="hljs-attr">    metadata:</span>
<span class="hljs-attr">      labels:</span>
<span class="hljs-attr">        app:</span> zuul-server
<span class="hljs-attr">    spec:</span>
<span class="hljs-attr">      containers:</span>
<span class="hljs-attr">        - image:</span> spring-zuul-server
<span class="hljs-attr">          name:</span> spring-zuul-server
<span class="hljs-attr">          imagePullPolicy:</span> Always
<span class="hljs-attr">          ports:</span>
<span class="hljs-attr">          - containerPort:</span> <span class="hljs-number">8888</span>
<span class="hljs-attr">          env:</span>
<span class="hljs-attr">          - name:</span> SPRING_PROFILES_ACTIVE
<span class="hljs-attr">            value:</span> dev
<span class="hljs-attr">          readinessProbe:</span>
<span class="hljs-attr">            httpGet:</span>
<span class="hljs-attr">              path:</span> /health
<span class="hljs-attr">              port:</span> <span class="hljs-number">8888</span>
<span class="hljs-attr">            initialDelaySeconds:</span> <span class="hljs-number">40</span>
<span class="hljs-attr">            timeoutSeconds:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">          resources:</span>
<span class="hljs-attr">            limits:</span>
<span class="hljs-attr">              cpu:</span> <span class="hljs-string">&quot;2&quot;</span>
<span class="hljs-attr">              memory:</span> <span class="hljs-number">2048</span>Mi
<span class="hljs-attr">            requests:</span>
<span class="hljs-attr">              cpu:</span> <span class="hljs-string">&quot;1&quot;</span>
<span class="hljs-attr">              memory:</span> <span class="hljs-number">1536</span>Mi
<span class="hljs-attr">      imagePullSecrets:</span>
<span class="hljs-attr">      - name:</span> docker-registry-key
</code></pre>
<ul>
<li>1&#x3001;&#x67E5;&#x770B;&#x90E8;&#x7F72;&#x7684;&#x955C;&#x50CF;</li>
</ul>
<pre><code class="lang-bash">kubectl get po
</code></pre>
<ul>
<li>2&#x3001;&#x67E5;&#x770B;&#x96C6;&#x7FA4;&#x8282;&#x70B9;&#x72B6;&#x6001;</li>
</ul>
<pre><code class="lang-bash">kubectl  get nodes  --namespace=demo
</code></pre>
<ul>
<li>3&#x3001;&#x67E5;&#x770B;&#x6240;&#x6709;&#x5B9E;&#x4F8B;</li>
</ul>
<pre><code class="lang-bash">kubectl  get po --namespace=demo
</code></pre>
<ul>
<li>4&#x3001;&#x8FDB;&#x5165;&#x5230;&#x5B9E;&#x4F8B;&#x67E5;&#x770B;&#x8FD0;&#x884C;&#x72B6;&#x6001;</li>
</ul>
<pre><code>kubectl attach pod spero-zuul-server-outer-5457f86875-z7vd9
</code></pre><ul>
<li>5&#x3001;&#x5220;&#x9664;&#x5B9E;&#x4F8B;</li>
</ul>
<pre><code>kubectl delete pod spero-zuul-server-outer-5457f86875-z7vd9
</code></pre><ul>
<li>6&#x3001;&#x4FEE;&#x6539;&#x5B9E;&#x4F8B;</li>
</ul>
<pre><code class="lang-bash">kubectl edit pod spero-zuul-server-outer-5457f86875-z7vd9
</code></pre>
<ul>
<li>6&#x3001;&#x8FDB;&#x5165;&#x5B9E;&#x4F8B;</li>
</ul>
<pre><code class="lang-bash">kubectl  <span class="hljs-built_in">exec</span>  spero-zuul-server-outer-5457f86875-z7vd9 -it bash
</code></pre>
<h4 id="22-&#x8BBE;&#x7F6E;&#x5BF9;&#x5916;&#x7684;&#x8BBF;&#x95EE;">2.2 &#x8BBE;&#x7F6E;&#x5BF9;&#x5916;&#x7684;&#x8BBF;&#x95EE;</h4>
<p>&#xA0;&#xA0;&#xA0;&#xA0;k8s&#x8BBE;&#x7F6E;&#x5BF9;&#x5916;&#x8BBF;&#x95EE;&#x7528;&#x4E24;&#x79CD;&#x65B9;&#x5F0F;&#xFF0C;&#x4E00;&#x79CD;&#x4E3A;NodePort&#xFF0C;&#x53E6;&#x4E00;&#x79CD;&#x4E3A;ingress&#xFF0C;NodePort&#x9700;&#x8981;&#x4F9D;&#x8D56;&#x4E8E;&#x516C;&#x7F51;IP&#xFF0C;NodePort&#x66B4;&#x9732;&#x670D;&#x52A1;&#x7684;&#x5F62;&#x5F0F;&#x4F1A;&#x5360;&#x7528;&#x4E3B;&#x673A;&#x7AEF;&#x53E3;&#xFF0C;&#x5BFC;&#x81F4;&#x7AEF;&#x53E3;&#x7F3A;&#x4E4F;&#x7BA1;&#x7406;&#xFF0C;&#x540C;&#x65F6;&#x4E5F;&#x65E0;&#x6CD5;&#x6839;&#x636E;http header&#x7B49;&#x505A;&#x8DEF;&#x7531;&#x8F6C;&#x53D1;&#xFF0C;&#x800C;ingress&#x5219;&#x89C4;&#x907F;&#x4E86;&#x57FA;&#x4E8E;NodePort&#x7684;&#x7F3A;&#x70B9;&#xFF0C;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x6D41;&#x91CF;&#x7684;&#x5165;&#x53E3;&#x548C;&#x8DEF;&#x7531;&#x8F6C;&#x53D1;&#x89C4;&#x5219;&#x3002;</p>
<h3 id="&#x4E09;&#x3001;&#x5E38;&#x89C1;&#x95EE;&#x9898;">&#x4E09;&#x3001;&#x5E38;&#x89C1;&#x95EE;&#x9898;</h3>
<ul>
<li>1&#x3001;k8s&#x8282;&#x70B9;&#x662F;&#x5982;&#x4F55;&#x8C03;&#x5EA6;&#x7684;&#xFF1F;</li>
</ul>
<p>&#x901A;&#x8FC7;&#x7F51;&#x7EDC;&#x67B6;&#x6784;&#x56FE;&#x53EF;&#x4EE5;&#x77E5;&#x9053;&#xFF0C;k8s&#x7269;&#x7406;&#x8282;&#x70B9;&#x5206;&#x4E3A;master&#x8282;&#x70B9;&#x548C;worker&#x8282;&#x70B9;</p>
<pre><code class="lang-bash"><span class="hljs-comment"># &#x67E5;&#x770B;&#x96C6;&#x7FA4;&#x4FE1;&#x606F;</span>
kubectl cluster-info

<span class="hljs-comment"># &#x67E5;&#x770B;&#x8282;&#x70B9;&#x5217;&#x8868;</span>
kubectl get nodes
</code></pre>
<p>master&#x8282;&#x70B9;&#x53EF;&#x4EE5;&#x663E;&#x5F0F;&#x5730;&#x6307;&#x5B9A;&#x662F;&#x5426;&#x5141;&#x8BB8;&#x88AB;&#x8C03;&#x5EA6;&#xFF0C;&#x82E5;&#x4E0D;&#x5141;&#x8BB8;&#x88AB;&#x8C03;&#x5EA6;&#xFF0C;&#x5219;&#x79F0;&#x4E3A;&#x6C61;&#x70B9;&#xFF0C;&#x5176;&#x9519;&#x8BEF;&#x4F1A;&#x8868;&#x73B0;&#x5982;&#x4E0B;:</p>
<pre><code>&#x9519;&#x8BEF;
0/6 nodes are available: 6 node(s) had taints that the pod didn&apos;t tolerate.
node(s) had taints that the pod didn&apos;t tolerate
</code></pre><pre><code class="lang-bash">&#x67E5;&#x770B;taint
kubectl get no -o yaml | grep taint -A 5

&#x5220;&#x9664;taint
kubectl taint nodes node1 key1:NoSchedule-
</code></pre>
<ul>
<li>2&#x3001;&#x5982;&#x4F55;&#x8BBE;&#x7F6E;&#x955C;&#x50CF;&#x8BBF;&#x95EE;&#x6743;&#x9650;&#xFF1F;</li>
</ul>
<pre><code class="lang-bash">kubectl create secret generic docker-registry-key --from-file=./docker-registry-key.txt

kubectl get secrets

kubectl describe secrets/docker-registry-key
</code></pre>
<p>&#x4F7F;&#x7528;&#x8BE5;secret&#x83B7;&#x53D6;image</p>
<pre><code class="lang-yaml"><span class="hljs-attr">imagePullSecrets:</span>
<span class="hljs-attr">- name:</span> docker-registry-key
</code></pre>
<ul>
<li>3 k8s&#x591A;&#x96C6;&#x7FA4;&#x73AF;&#x5883;&#x5982;&#x4F55;&#x5207;&#x6362;&#xFF1F;</li>
</ul>
<p>&#xA0;&#xA0;&#xA0;&#xA0;&#x5728;<code>vim ~/.kube/config</code>&#x4E2D;&#x914D;&#x7F6E;&#x5982;&#x4E0B;:</p>
<pre><code class="lang-yaml"><span class="hljs-attr">apiVersion:</span> v1
<span class="hljs-attr">clusters:</span>
<span class="hljs-attr">- cluster:</span>
<span class="hljs-attr">    certificate-authority-data:</span> <span class="hljs-string">&quot;your certificate-authority-data&quot;</span>
<span class="hljs-attr">    server:</span> https://<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6443</span>
<span class="hljs-attr">  name:</span> k8s-dev
<span class="hljs-attr">- cluster:</span>
<span class="hljs-attr">    certificate-authority-data:</span> <span class="hljs-string">&quot;your certificate-authority-data&quot;</span>
<span class="hljs-attr">    server:</span> https://<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6443</span>
<span class="hljs-attr">  name:</span> k8s-prod
<span class="hljs-attr">contexts:</span>
<span class="hljs-attr">- context:</span>
<span class="hljs-attr">    cluster:</span> k8s-dev
<span class="hljs-attr">    namespace:</span> spero-dev
<span class="hljs-attr">    user:</span> k8s-dev
<span class="hljs-attr">  name:</span> k8s-dev
<span class="hljs-attr">- context:</span>
<span class="hljs-attr">    cluster:</span> k8s-prod
<span class="hljs-attr">    namespace:</span> spero-prod
<span class="hljs-attr">    user:</span> k8s-prod
<span class="hljs-attr">  name:</span> k8s-prod
<span class="hljs-attr">current-context:</span> k8s-dev
<span class="hljs-attr">kind:</span> Config
<span class="hljs-attr">preferences:</span> {}
<span class="hljs-attr">users:</span>
<span class="hljs-attr">- name:</span> k8s-dev
<span class="hljs-attr">  user:</span>
<span class="hljs-attr">    client-certificate-data:</span> <span class="hljs-string">&quot;your client-certificate-data&quot;</span>
<span class="hljs-attr">    client-key-data:</span> <span class="hljs-string">&quot;your client-key-data&quot;</span>
<span class="hljs-attr">- name:</span> k8s-prod
<span class="hljs-attr">  user:</span>
<span class="hljs-attr">    client-certificate-data:</span> <span class="hljs-string">&quot;your client-certificate-data&quot;</span>
<span class="hljs-attr">    client-key-data:</span> <span class="hljs-string">&quot;your client-key-data&quot;</span>
</code></pre>
<pre><code class="lang-bash"><span class="hljs-comment"># dev&#x73AF;&#x5883;</span>
kubectl config use-context k8s-dev

<span class="hljs-comment"># prod&#x73AF;&#x5883;</span>
kubectl config use-context k8s-prod
</code></pre>
<ul>
<li>4 &#x5982;&#x4F55;&#x9009;&#x62E9;&#x5065;&#x5EB7;&#x68C0;&#x67E5;&#xFF1F;</li>
</ul>
<p>&#xA0;&#xA0;&#xA0;&#xA0;&#x5065;&#x5EB7;&#x68C0;&#x67E5;&#x4E3B;&#x8981;&#x8FD0;&#x7528;&#x5728;&#x5BB9;&#x5668;&#x7BA1;&#x7406;&#x3001;&#x6EDA;&#x52A8;&#x5347;&#x7EA7;&#x3001;&#x8D1F;&#x8F7D;&#x5747;&#x8861;&#x7B49;&#x65B9;&#x9762;&#xFF0C;k8s&#x4E2D;&#x6709;&#x4E24;&#x79CD;&#x5065;&#x5EB7;&#x68C0;&#x67E5;&#x914D;&#x7F6E;&#x9009;&#x9879;:</p>
<pre><code class="lang-yaml"><span class="hljs-attr">livenessProbe:</span>
<span class="hljs-attr">  httpGet:</span>
<span class="hljs-attr">    path:</span> /health
<span class="hljs-attr">    port:</span> <span class="hljs-number">8888</span>
<span class="hljs-attr">  initialDelaySeconds:</span> <span class="hljs-number">40</span>
<span class="hljs-attr">  timeoutSeconds:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">readinessProbe:</span>
<span class="hljs-attr">  httpGet:</span>
<span class="hljs-attr">    path:</span> /health
<span class="hljs-attr">    port:</span> <span class="hljs-number">8888</span>
<span class="hljs-attr">  initialDelaySeconds:</span> <span class="hljs-number">40</span>
<span class="hljs-attr">  timeoutSeconds:</span> <span class="hljs-number">1</span>
</code></pre>
<p>livenessProbe&#x5224;&#x65AD;&#x5BB9;&#x5668;&#x672C;&#x8EAB;&#x662F;&#x5426;&#x5065;&#x5EB7;&#xFF0C;readinessProbe&#x5224;&#x65AD;&#x5BB9;&#x5668;&#x5E94;&#x7528;&#x662F;&#x5426;&#x5065;&#x5EB7;&#xFF0C;&#x56E0;&#x6B64;&#x670D;&#x52A1;&#x9700;&#x8981;&#x5BF9;&#x5916;&#x63D0;&#x4F9B;&#x5065;&#x5EB7;&#x68C0;&#x67E5;&#x63A5;&#x53E3;</p>
<ul>
<li>5 &#x90E8;&#x7F72;&#x65F6;&#x5982;&#x4F55;&#x89E3;&#x51B3;&#x670D;&#x52A1;&#x4F9D;&#x8D56;&#xFF1F;</li>
</ul>
<p>&#xA0;&#xA0;&#xA0;&#xA0;&#x5FAE;&#x670D;&#x52A1;&#x90E8;&#x7F72;&#x4EA4;&#x4ED8;&#x4E2D;&#xFF0C;&#x591A;&#x4E2A;&#x670D;&#x52A1;&#x4E1A;&#x52A1;&#x4E0A;&#x548C;&#x542F;&#x52A8;&#x987A;&#x5E8F;&#x4E0A;&#x53EF;&#x80FD;&#x4F1A;&#x5B58;&#x5728;&#x4F9D;&#x8D56;&#x5173;&#x7CFB;&#xFF0C;&#x901A;&#x8FC7;&#x5982;&#x4E0B;&#x9009;&#x9879;&#x89E3;&#x51B3;:</p>
<pre><code class="lang-yaml"><span class="hljs-attr">initContainers:</span>
<span class="hljs-attr">- name:</span> my-eureka-server
<span class="hljs-attr">  image:</span> my-eureka-server:latest
<span class="hljs-attr">  command:</span> [<span class="hljs-string">&apos;sh&apos;</span>, <span class="hljs-string">&apos;-c&apos;</span>, <span class="hljs-string">&quot;curl --connect-timeout 3 --max-time 5 --retry 10 --retry-delay 5 --retry-max-time 60 my-eureka-server:8888/health&quot;</span>]
</code></pre>
<p>&#x5176;&#x4E2D;initContainers.name&#x8868;&#x793A;&#x88AB;&#x4F9D;&#x8D56;&#x7684;&#x670D;&#x52A1;</p>
<ul>
<li>6 k8s port&#x6709;&#x51E0;&#x79CD;&#xFF0C;&#x5206;&#x522B;&#x8D77;&#x4EC0;&#x4E48;&#x4F5C;&#x7528;&#xFF1F;</li>
</ul>
<pre><code>- NodePort: &#x7269;&#x7406;&#x8282;&#x70B9;&#x4E3B;&#x673A;&#x7684;IP&#xFF0C;&#x4E0E;&#x5B83;&#x662F;&#x5426;&#x5C5E;&#x4E8E;K8s&#x65E0;&#x5173;
- port: Dokcer Engine&#x901A;&#x8FC7;docker0&#x7F51;&#x6865;&#x7684;IP&#x5730;&#x5740;&#x6BB5;&#x8FDB;&#x884C;&#x5206;&#x914D;&#x7684;&#xFF0C;&#x901A;&#x5E38;&#x662F;&#x4E00;&#x4E2A;&#x865A;&#x62DF;&#x7684;&#x4E8C;&#x5C42;&#x7F51;&#x7EDC;&#xFF0C;k8s&#x4E2D;&#x4E00;&#x4E2A;Pod&#x8BBF;&#x95EE;&#x53E6;&#x4E00;&#x4E2A;Pod&#x5C31;&#x662F;&#x901A;&#x8FC7;Pod IP
- Cluster IP: &#x62BD;&#x8C61;&#x7684;Service&#xFF0C;&#x5C5E;&#x4E8E;k8s&#x7684;&#x5185;&#x90E8;IP&#xFF0C;&#x5916;&#x754C;&#x65E0;&#x6CD5;&#x76F4;&#x63A5;&#x8BBF;&#x95EE;
</code></pre><p>&#xA0;&#xA0;&#xA0;&#xA0;&#x603B;&#x7684;&#x6765;&#x8BF4;&#xFF0C;port&#x548C;nodePort&#x90FD;&#x662F;service&#x7684;&#x7AEF;&#x53E3;&#xFF0C;&#x524D;&#x8005;&#x66B4;&#x9732;&#x7ED9;&#x96C6;&#x7FA4;&#x5185;&#x5BA2;&#x6237;&#x8BBF;&#x95EE;&#x670D;&#x52A1;&#xFF0C;&#x540E;&#x8005;&#x66B4;&#x9732;&#x7ED9;&#x96C6;&#x7FA4;&#x5916;&#x5BA2;&#x6237;&#x8BBF;&#x95EE;&#x670D;&#x52A1;&#x3002;&#x4ECE;&#x8FD9;&#x4E24;&#x4E2A;&#x7AEF;&#x53E3;&#x5230;&#x6765;&#x7684;&#x6570;&#x636E;&#x90FD;&#x9700;&#x8981;&#x7ECF;&#x8FC7;&#x53CD;&#x5411;&#x4EE3;&#x7406;kube-proxy&#x6D41;&#x5165;&#x540E;&#x7AEF;pod&#x7684;targetPod&#xFF0C;&#x4ECE;&#x800C;&#x5230;&#x8FBE;pod&#x4E0A;&#x7684;&#x5BB9;&#x5668;&#x5185;&#x3002;</p>
<ul>
<li>7 Cluter IP&#x7684;&#x5B9E;&#x73B0;&#x539F;&#x7406;&#x662F;&#x4EC0;&#x4E48;&#xFF1F;</li>
</ul>
<p>&#xA0;&#xA0;&#xA0;&#xA0; &#x5F53;service&#x6709;&#x4E86;port&#x548C;nodePort&#x4E4B;&#x540E;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x5BF9;&#x5185;/&#x5916;&#x63D0;&#x4F9B;&#x670D;&#x52A1;&#x3002;&#x90A3;&#x4E48;&#x5176;&#x5177;&#x4F53;&#x662F;&#x901A;&#x8FC7;&#x4EC0;&#x4E48;&#x539F;&#x7406;&#x6765;&#x5B9E;&#x73B0;&#x7684;&#x5462;&#xFF1F;&#x5965;&#x5999;&#x5C31;&#x5728;kube-proxy&#x5728;&#x672C;&#x5730;node&#x4E0A;&#x521B;&#x5EFA;&#x7684;iptables&#x89C4;&#x5219;&#x3002;Kube-Proxy &#x901A;&#x8FC7;&#x914D;&#x7F6E; DNAT &#x89C4;&#x5219;&#xFF0C;&#x5C06;&#x5230;&#x8FD9;&#x4E2A;&#x670D;&#x52A1;&#x5730;&#x5740;&#x7684;&#x8BBF;&#x95EE;&#x6620;&#x5C04;&#x5230;&#x672C;&#x5730;&#x7684;kube-proxy&#x7AEF;&#x53E3;&#xFF08;&#x968F;&#x673A;&#x7AEF;&#x53E3;&#xFF09;&#x3002;&#x7136;&#x540E; Kube-Proxy &#x4F1A;&#x76D1;&#x542C;&#x5728;&#x672C;&#x5730;&#x7684;&#x5BF9;&#x5E94;&#x7AEF;&#x53E3;&#xFF0C;&#x5C06;&#x5230;&#x8FD9;&#x4E2A;&#x7AEF;&#x53E3;&#x7684;&#x8BBF;&#x95EE;&#x7ED9;&#x4EE3;&#x7406;&#x5230;&#x8FDC;&#x7AEF;&#x771F;&#x5B9E;&#x7684; pod &#x5730;&#x5740;&#x4E0A;&#x53BB;&#xFF0C;&#x800C;service hostname&#x7684;&#x89E3;&#x6790;&#x5219;&#x662F;&#x501F;&#x52A9;&#x4E8E;k8s&#x7684;kubedns&#x5B9E;&#x73B0;&#x3002;</p>
<ul>
<li>8 k8s&#x96C6;&#x7FA4;&#x5982;&#x4F55;&#x4FDD;&#x8BC1;&#x9AD8;&#x53EF;&#x7528;&#xFF1F;</li>
</ul>
<p>&#xA0;&#xA0;&#xA0;&#xA0; k8s&#x7684;&#x9AD8;&#x53EF;&#x7528;&#x4E3B;&#x8981;&#x5305;&#x542B;&#x4E09;&#x4E2A;&#x65B9;&#x9762;&#xFF0C;1&#x3001;&#x5E94;&#x7528;&#x5C42;&#x7684;&#x9AD8;&#x53EF;&#x7528; 2&#x3001;etcd&#x5B58;&#x50A8;&#x7684;&#x9AD8;&#x53EF;&#x7528; 3&#x3001;master&#x8282;&#x70B9;&#x7684;&#x9AD8;&#x53EF;&#x7528;&#xFF0C;Cluster IP + etcd&#x7684;&#x65B9;&#x5F0F;&#x5DF2;&#x7ECF;&#x4FDD;&#x8BC1;&#x4E86;&#x5E94;&#x7528;&#x5C42;&#x7684;&#x9AD8;&#x53EF;&#x7528;&#xFF0C;&#x800C;etcd&#x670D;&#x52A1;&#x591A;&#x8282;&#x7684;&#x96C6;&#x7FA4;&#x90E8;&#x7F72;&#x4EA6;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x81EA;&#x8EAB;&#x7684;&#x9AD8;&#x53EF;&#x7528;&#xFF0C;&#x63A5;&#x4E0B;&#x6765;&#x770B;&#x4E0B;master&#x662F;&#x5982;&#x4F55;&#x5B9E;&#x73B0;&#x9AD8;&#x53EF;&#x7528;&#x7684;:</p>
<p>&#xA0;&#xA0;&#xA0;&#xA0; APIserver&#x4F5C;&#x4E3A;&#x96C6;&#x7FA4;&#x7684;&#x6838;&#x5FC3;&#xFF0C;&#x8D1F;&#x8D23;&#x96C6;&#x7FA4;&#x5404;&#x529F;&#x80FD;&#x6A21;&#x5757;&#x4E4B;&#x95F4;&#x7684;&#x901A;&#x4FE1;&#xFF0C;&#x96C6;&#x7FA4;&#x5185;&#x7684;&#x5404;&#x4E2A;&#x529F;&#x80FD;&#x6A21;&#x5757;&#x901A;&#x8FC7;apiserver&#x5C06;&#x4FE1;&#x606F;&#x5B58;&#x5165;etcd&#xFF0C;&#x5F53;&#x9700;&#x8981;&#x83B7;&#x53D6;&#x548C;&#x64CD;&#x4F5C;&#x8FD9;&#x4E9B;&#x6570;&#x636E;&#x65F6;&#xFF0C;&#x5219;&#x901A;&#x8FC7;apiserver&#x63D0;&#x4F9B;&#x7684;rest&#x63A5;&#x53E3;&#x6765;&#x5B9E;&#x73B0;&#xFF0C;&#x4ECE;&#x800C;&#x5B9E;&#x73B0;&#x5404;&#x6A21;&#x5757;&#x4E4B;&#x95F4;&#x7684;&#x4FE1;&#x606F;&#x4EA4;&#x4E92;&#x3002;</p>
<p>&#xA0;&#xA0;&#xA0;&#xA0; APIserver&#x6700;&#x4E3B;&#x8981;&#x7684;rest&#x63A5;&#x53E3;&#x662F;&#x8D44;&#x6E90;&#x5BF9;&#x8C61;&#x7684;&#x589E;&#x5220;&#x67E5;&#x6539;&#xFF0C;&#x9664;&#x6B64;&#x4E4B;&#x5916;&#xFF0C;&#x5B83;&#x8FD8;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x7C7B;&#x5F88;&#x7279;&#x6B8A;&#x7684;rest&#x63A5;&#x53E3;KubernetesProxyAPI&#x63A5;&#x53E3;&#xFF0C;&#x8FD9;&#x7C7B;&#x63A5;&#x53E3;&#x7684;&#x4F5C;&#x7528;&#x662F;&#x4EE3;&#x7406;rest&#x8BF7;&#x6C42;&#xFF0C;&#x5373;apiserver&#x628A;&#x6536;&#x5230;&#x7684;rest&#x8BF7;&#x6C42;&#x8F6C;&#x53D1;&#x5230;&#x67D0;&#x4E2A;node&#x4E0A;&#x7684;kubelet&#x5B88;&#x62A4;&#x8FDB;&#x7A0B;&#x7684;rest&#x7AEF;&#x53E3;&#x4E0A;&#xFF0C;&#x7531;&#x8BE5;kubelet&#x8FDB;&#x7A0B;&#x8D1F;&#x8D23;&#x54CD;&#x5E94;&#x3002;&#x5728;kubernetes&#x96C6;&#x7FA4;&#x4E4B;&#x5916;&#x8BBF;&#x95EE;&#x67D0;&#x4E2A;pod&#x5BB9;&#x5668;&#x7684;&#x670D;&#x52A1;&#xFF08;http&#x670D;&#x52A1;&#xFF09;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x7528;proxyAPI&#x5B9E;&#x73B0;&#xFF0C;&#x8FD9;&#x79CD;&#x573A;&#x666F;&#x591A;&#x7528;&#x4E8E;&#x7BA1;&#x7406;&#x76EE;&#x7684;&#x3002;</p>
<p>&#xA0;&#xA0;&#xA0;&#xA0; &#x6BCF;&#x4E2A;node&#x8282;&#x70B9;&#x4E0A;&#x7684;kubelet&#x6BCF;&#x9694;&#x4E00;&#x4E2A;&#x65F6;&#x95F4;&#x5468;&#x671F;&#xFF0C;&#x5C31;&#x4F1A;&#x8C03;&#x7528;&#x4E00;&#x6B21;apiserver&#x7684;rest&#x63A5;&#x53E3;&#x62A5;&#x544A;&#x81EA;&#x8EAB;&#x72B6;&#x6001;&#xFF0C;apiserver&#x63A5;&#x6536;&#x5230;&#x8FD9;&#x4E9B;&#x4FE1;&#x606F;&#x540E;&#xFF0C;&#x5C06;&#x8282;&#x70B9;&#x72B6;&#x6001;&#x4FE1;&#x606F;&#x66F4;&#x65B0;&#x5230;etcd&#x3002;&#x6B64;&#x5916;&#xFF0C;kubelet&#x4E5F;&#x901A;&#x8FC7;apiserver&#x7684;watch&#x63A5;&#x53E3;&#x76D1;&#x542C;pod&#x4FE1;&#x606F;&#xFF0C;&#x5982;&#x679C;&#x76D1;&#x542C;&#x5230;&#x65B0;&#x7684;pod&#x526F;&#x672C;&#x88AB;&#x8C03;&#x5EA6;&#x7ED1;&#x5B9A;&#x5230;&#x672C;&#x8282;&#x70B9;&#xFF0C;&#x5219;&#x6267;&#x884C;pod&#x5BF9;&#x5E94;&#x7684;&#x5BB9;&#x5668;&#x7684;&#x521B;&#x5EFA;&#x548C;&#x542F;&#x52A8;&#x903B;&#x8F91;&#xFF1B;&#x5982;&#x679C;&#x76D1;&#x542C;&#x5230;pod&#x5BF9;&#x8C61;&#x88AB;&#x5220;&#x9664;&#xFF0C;&#x5219;&#x5220;&#x9664;&#x672C;&#x8282;&#x70B9;&#x4E0A;&#x7684;&#x54CD;&#x5E94;&#x7684;pod&#x5BB9;&#x5668;&#xFF1B;&#x5982;&#x679C;&#x76D1;&#x542C;&#x5230;&#x4FEE;&#x6539;pod&#x4FE1;&#x606F;&#xFF0C;&#x5219;kubelet&#x76D1;&#x542C;&#x5230;&#x53D8;&#x5316;&#x540E;&#xFF0C;&#x4F1A;&#x76F8;&#x5E94;&#x5730;&#x4FEE;&#x6539;&#x672C;&#x8282;&#x70B9;&#x7684;pod&#x5BB9;&#x5668;</p>
<h3 id="&#x56DB;&#x3001;&#x53C2;&#x8003;">&#x56DB;&#x3001;&#x53C2;&#x8003;</h3>
<ul>
<li><a href="https://kubernetes.io/cn/docs/" target="_blank">1&#x3001;k8s&#x5B98;&#x7F51;</a></li>
<li><a href="https://www.cnblogs.com/keithtt/p/7896948.html" target="_blank">2&#x3001;&#x9AD8;&#x53EF;&#x7528;</a></li>
<li><a href="https://blog.csdn.net/Dustin_CDS/article/details/79439596" target="_blank">3&#x3001;k8s&#x67B6;&#x6784;</a></li>
<li><a href="https://www.cnblogs.com/ssooking/p/7890192.html" target="_blank">4&#x3001;iptables&#x7AEF;&#x53E3;&#x8F6C;&#x53D1;</a></li>
<li><a href="https://gist.github.com/baymaxium/7797f226fe03d38461f33fdd02145b11" target="_blank">5&#x3001;&#x63A2;&#x7D22;k8s</a></li>
<li><a href="https://www.kubernetes.org.cn/4956.html" target="_blank">5&#x3001;k8s&#x90E8;&#x7F72;</a></li>
</ul>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; &#x4E00;&#x84D1;&#x70DF;&#x96E8;&#x4EFB;&#x5E73;&#x751F; all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x4FEE;&#x6539;&#x65F6;&#x95F4;: 
2021-04-09 11:09:03
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../build.html" class="navigation navigation-prev " aria-label="Previous page: 3.3 部署">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../rancher/rancher.html" class="navigation navigation-next " aria-label="Next page: 3.3.2 rancher">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"3.3.1 k8s","level":"1.4.3.1","depth":3,"next":{"title":"3.3.2 rancher","level":"1.4.3.2","depth":3,"path":"engineering/ci_deplopment/rancher/rancher.md","ref":"engineering/ci_deplopment/rancher/rancher.md","articles":[]},"previous":{"title":"3.3 部署","level":"1.4.3","depth":2,"path":"engineering/ci_deplopment/build.md","ref":"engineering/ci_deplopment/build.md","articles":[{"title":"3.3.1 k8s","level":"1.4.3.1","depth":3,"path":"engineering/ci_deplopment/k8s/k8s.md","ref":"engineering/ci_deplopment/k8s/k8s.md","articles":[]},{"title":"3.3.2 rancher","level":"1.4.3.2","depth":3,"path":"engineering/ci_deplopment/rancher/rancher.md","ref":"engineering/ci_deplopment/rancher/rancher.md","articles":[]},{"title":"3.3.3 swarm","level":"1.4.3.3","depth":3,"path":"engineering/ci_deplopment/swarm/swarm.md","ref":"engineering/ci_deplopment/swarm/swarm.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["disqus","tree","splitter","local-video","chart","github-buttons","tbfed-pagefooter","ace","katex"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy 一蓑烟雨任平生","modify_label":"修改时间: ","modify_format":"YYYY-MM-DD HH:mm:ss"},"disqus":{"useIdentifier":false,"shortName":"gitbookuse"},"ace":{},"splitter":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"katex":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"github-buttons":{"repo":"TIME-GATE/","types":["star","watch"],"size":"large"},"local-video":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"tree":{},"chart":{"type":"c3"}},"theme":"default","author":"zq_sdk@163.com","name":"name","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Ebook","language":"zh-hans","gitbook":"*","description":"电子书"},"file":{"path":"engineering/ci_deplopment/k8s/k8s.md","mtime":"2021-04-09T03:09:03.301Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-04-10T12:23:44.633Z"},"basePath":"../../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../../gitbook/gitbook.js"></script>
    <script src="../../../gitbook/theme.js"></script>
    
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.16.1/URI.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-disqus/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-tree/jquery.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-tree/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-local-video/video.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-ace/ace/ace.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-ace/ace.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

